<style>
    .tpl-lists{
        min-width: 700px;
        border: 1px solid #ccc;
        overflow: hidden;
        margin-bottom: 10px;
    }
    .tpl-list{

        width: 100%;
        height: auto;
        padding: 5px;
        border-bottom: 1px solid #ccc;
        overflow: hidden;
        line-height: 30px;

    }
    .tpl-list.default{

        background: #e7e7e7;

    }
    .tpl-list:last-child{

        border: none;

    }
    .rlb-no{

        border-left:none !important;
        border-right: none !important;

    }
    .areas{

        width: 20%;

    }
    .first,.first-price,.other,.other-price,.do-action{

        width: 14%;
        margin-left: 10px;


    }

</style>
<div class="col-xs-12 col-md-12 col-lg-12 padding-none lists" id="tpl-list">
        <?php foreach($data as $v):?>

        <div class="tpl-lists">
            <div class="tpl-list default">
                <div class="pull-left">模板名称: <?php echo $v['title']?></div>
                <div class="pull-right">
                    <a href="javascript:;" data-id="<?php echo $v['id']?>" class="btn btn-success btn-xs edit radius-none">编辑</a>
                    <!--<a href="javascript:;" class="btn btn-danger btn-xs delete radius-none">删除</a>-->
                </div>
            </div>

            <?php foreach($v['transport'] as $val):?>
                <?php if($val['is_default'] == 1):?>
                <div class="tpl-list default">
                    <div class="input-group input-group-sm">
                        <span class="input-group-addon radius-none">默认运费:</span>
                        <div class="form-control radius-none text-center"><?php echo $val['snum']?></div>
                        <span class="input-group-addon radius-none rlb-no">件内,</span>
                        <div class="form-control radius-none text-center"><?php echo sprintf("%.2f", ($val['sprice'] / 100))?></div>
                        <span class="input-group-addon radius-none rlb-no">元,</span>
                        <span class="input-group-addon radius-none rlb-no">每增加</span>
                        <div class="form-control radius-none text-center"><?php echo $val['xnum']?></div>
                        <span class="input-group-addon radius-none rlb-no">件,</span>
                        <span class="input-group-addon radius-none rlb-no">增加运费</span>
                        <div class="form-control radius-none text-center"><?php echo sprintf("%.2f", ($val['xprice'] / 100))?></div>
                        <span class="input-group-addon radius-none">元</span>
                    </div>
                </div>

                <div class="tpl-list">
                    <div class="areas pull-left">运送到</div>
                    <div class="first pull-left">首件(件)</div>
                    <div class="first-price pull-left">首费(元)</div>
                    <div class="other pull-left">续件(件)</div>
                    <div class="other-price pull-left">续费(元)</div>
                </div>
                <?php else:?>
                    <div class="tpl-list">
                        <div class="areas pull-left" data-container="body" data-toggle="popover" data-placement="left" data-content="<?php echo $val['county_names']?>">
                            <?php echo str_cut($val['county_names'],30,'...')?>
                        </div>
                        <div class="first pull-left">
                            <div class="input-group input-group-sm">
                                <div class="form-control radius-none text-center"><?php echo $val['snum']?></div>
                            </div>
                        </div>
                        <div class="first-price pull-left">
                            <div class="input-group input-group-sm">
                                <div class="form-control radius-none text-center"><?php echo sprintf("%.2f", ($val['sprice'] / 100))?></div>
                                <span class="input-group-addon radius-none">元</span>
                            </div>
                        </div>
                        <div class="other pull-left">
                            <div class="input-group input-group-sm">
                                <div class="form-control radius-none text-center"><?php echo $val['xnum']?></div>
                            </div>
                        </div>
                        <div class="other-price pull-left">
                            <div class="input-group input-group-sm">
                                <div class="form-control radius-none text-center"><?php echo sprintf("%.2f", ($val['xprice'] / 100))?></div>
                                <span class="input-group-addon radius-none">元</span>
                            </div>
                        </div>
                    </div>
                <?php endif;?>
            <?php endforeach;?>
        </div>
        <?php endforeach;?>
</div>
<script>

    $(function(){

        $('.edit','#tpl-list').unbind('click')
        $('.edit','#tpl-list').click(function(){

            var data = {};

            data.id = $(this).data('id');

            showMessage('','','<?php echo U("Admin/Logistics/FreightTpl/update")?>',data,0);

        });

        $('.tpl-lists').undelegate('.areas','click');
        $('.tpl-lists').delegate('.areas','mouseover',function(){

            $(this).popover('show');

        });
        $('.tpl-lists').undelegate('.areas','click');
        $('.tpl-lists').delegate('.areas','mouseout',function(){

            $(this).popover('hide');

        });

    })

</script>
